package com.product.android.commonInterface;

import com.product.android.utils.LogUtils;


public class BaseCommonStruct {
	
    public String sPara = "";
    public long lPara = 0;
    public int iPara;
    public boolean bPara=false;
    public Object obj1;		//通常情况下作为入参使用
    public Object obj2;		//通常情况下作为出参，根据实际情况使用
    
    /**
     * @n<b>函数名称</b>     :packToString
     * @brief 参数错误时把数据转换字符串显示
     * @version    Ver 1.3.3_modularization
     * @param  @return
     * @<b>作者</b>          :  cb
     * @<b>创建时间</b>      :  2014-2-26下午4:10:00      
    */
    private void printParaError(String method){
    	StringBuilder builder=new StringBuilder();
    	builder.append("sPara="+sPara);
    	builder.append(",lPara="+lPara);
    	builder.append(",iPara="+iPara);
    	builder.append(",bPara="+bPara);
    	builder.append(",obj1="+obj1);
    	builder.append(",obj2="+obj2);
    	//调试阶段给toast提示并写log，稳定之后只显示log
    	LogUtils.e("commoninterface","param error,method:"+method+",param:"+builder.toString());
//    	ToastUtils.display("commoninterface param error,method:"+method+",param:"+builder.toString());
    }
    
    public void showError(int result,String method){
    	switch (result) {
		case CIConst.COM_RET_PARA_ERROR:
			printParaError("commoninterface."+method);
			break;
		case CIConst.COM_RET_NO_NETWORK:
			LogUtils.e("commoninterface","no network:"+method);
			break;
		case CIConst.COM_RET_IMS_OFFLINE:
			LogUtils.e("commoninterface","ims offline:"+method);
			break;
		case CIConst.COM_RET_NO_ID_DIFINE:
			LogUtils.e("commoninterface","id not defined,method:"+method);
			break;
		case CIConst.COM_RET_NO_MODEL_REGISTER:
			LogUtils.e("commoninterface", "model not registed,method:"+method);
			break;
		case CIConst.COM_RET_OK:
			break;
		default:
			break;
		}
	}
}
